<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head>
    <head th:replace="fragments::header"/>
    <title>邮件中心</title>
    <style>
        .mail-table {
            margin: 0 auto;
            width: 70%;
            min-width: 500px;
        }

        table thead th {
            text-align: center;
        }

        table tbody td {
            color: black;
        }
    </style>
<body class="landing">
<div id="page-wrapper">
    <header th:replace="fragments::wrapper"/>
    <div th:replace="fragments::bootStrap"></div>
    <div class="container" id="detail-content">
        <form class="form-inline center-block" th:action="@{/email}">
            <div class="col-sm-offset-3">
                <div class="form-group">
                    <label for="inputSubject">主题</label>
                    <input type="text" name="subject" th:value="${mailConfig.subject}" class="form-control"
                           id="inputSubject" placeholder="Jane Doe">
                </div>
                <div class="form-group">
                    <label for="inputEmail">邮箱</label>
                    <input type="text" name="setTo" th:value="${mailConfig.setTo}" class="form-control" id="inputEmail"
                           placeholder="jane.doe@example.com">
                </div>
                <button type="submit" class="btn btn-default btn-sm">查询</button>
                <a type="button" class="btn btn-info" th:href="@{/email/addEmail}">写邮件</a>
            </div>
        </form>
        <div class="table-responsive mail-table">
            <table class="table table-bordered table-hover table-condensed">
                <colgroup>
                    <col style="width: 60px;">
                    <col>
                    <col>
                    <col style="width: 200px;">
                    <col style="width: 100px;">
                </colgroup>
                <thead>
                <tr>
                    <th>序号</th>
                    <th>收件人</th>
                    <th>主题</th>
                    <th>发件时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="email : ${result.data}" th:class="${emailStat.even}?'active':'info'">
                    <td th:text="${emailStat.index+1}">1</td>
                    <td th:text="${#strings.abbreviate(email.setTo,20)}" th:title="${email.setTo}">收件人</td>
                    <td th:text="${#strings.abbreviate(email.subject,20)}" th:title="${email.subject}">主题</td>
                    <td th:text="${#dates.format(email.createTime,'yyyy-MM-dd HH:mm:ss')}">发件时间</td>
                    <td><a href="javascript:void (0);" class="glyphicon glyphicon-list"
                           th:href="@{/email/detail(mailId=${email.mailId})}">详情</a></td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
<div th:replace="fragments::foot"></div>
</body>
</html>